using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Core.func.sql;
using FutureOpen.Web.Pages;


public partial class controls_GroupUsrs : System.Web.UI.UserControl
{
    private PageBase pbase;
    private int group_id;
    private int PAGE_SIZE = 20;

    protected void Page_Load(object sender, EventArgs e)
    {
        pbase = (PageBase)this.Page;
        pbase.PageInit();
        group_id = pbase.orgid;

        if (!Page.IsPostBack)
        {
            this.AspNetPager1.PageSize = PAGE_SIZE;
            this.AspNetPager1.RecordCount = GroupProvider.GetGroupUsrByGroupCOUNT(group_id);

            LoadUsers(0, PAGE_SIZE);
        }
    }
    public void LoadUsers(int start, int count)
    {
        if (this.group_id >= 0)
        {
            DataSet ds = GroupProvider.GetGroupUsrByGroup(group_id, start, start+count);
            this.dlUsrs.DataSource = ds.Tables[0];
            this.dlUsrs.DataBind();
        }

    }
    public string GetUsrUrl(object id, object name)
    {
        return pbase.GetUsrUrl(Convert.ToInt32(id), name.ToString());
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        LoadUsers((e.NewPageIndex - 1) * 20, 20);
    }
}
